package main

import (
	"cmp"
	"fmt"
	"os"
	"slices"
)

func functest4main() {
	strs := []string{"c", "a", "b", "e", "aa"}
	slices.Sort(strs)
	fmt.Println(strs)
	ints := []int{5, 2, 4, 1}
	slices.Sort(ints)
	sint := slices.IsSorted(ints)
	fmt.Println(sint)
	s5()
}
func s5() {
	frus := []string{"ernxxxxxxxui", "12enmkl", "zxcopi0-", "a", "23czxioasdkol", "dd3e"}
	lencmp := func(i, j string) int { return cmp.Compare(len(i), len(j)) }
	slices.SortFunc(frus, lencmp)
	fmt.Println(frus)
	type Person struct {
		Name string
		Age  int
	}
	people := []Person{
		{Name: "kso", Age: 20},
		{Name: "kso1", Age: 30},
		{Name: "kso4", Age: 40},
	}
	slices.SortFunc(people, func(a, b Person) int {
		return cmp.Compare(len(a.Name), len(b.Name))
	})
	fmt.Println(people)

	panic("a problem!!")
	_, err := os.Create("./")
	if err != nil {
		panic(err)
	}
}
